<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ajax检测用户是否已经注册</title>
<script type="text/javascript" src="/ZDNFProject/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" >
$(function(){
	$("#username").blur(function(){
		
		var json ={"username":$("#username").val()};
		$.get("http://localhost:8080/ZDNFProject/RegisterAjaxServlet",json,function(data,suss){
			alert(data);
			if(data=="true"){
			
				$("#message").text("用户已经被注册过").css('color','#E52F09');
			}else{
				$("#message").text("可以正常注册").css('color','#2A00FF');
			}
			
		});
		
	});
});
</script>
</head>
<body>
我的ajaxDemo
<form action="">
<input type="text" id="username" name="username">
<span id="message"></span>
</form>

</body>
</html>